﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MainAdmin.Master" CodeBehind="AdminBorrow.aspx.vb" Inherits="QLThuVien.AdminBorrow" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">

    function showCurrentDayM(s, e) {
        s.SetText(new Date());
    }
    function showCurrentDayT(s, e) {
        if (s.GetValue() == "0") {
            de_ngaytra.SetText(new Date());
        }
    }
    function clearAllTextM(s, e) {
        ASPxClientEdit.ClearEditorsInContainerById('containerM');
    }
    function clearAllTextT(s, e) {
        ASPxClientEdit.ClearEditorsInContainerById('containerT');
    }
    function clearContentUrl(s, e) {
        s.RefreshContentUrl(); 
    }
    function loadingPanelMaSach(s, e) {
       
            lp_masach.Show();
    }
    function showLoadingPanelPopUPM(s, e) {
        var isValid = ASPxClientEdit.ValidateGroup("vgMuon");
        if (isValid == true) {
            lp_popupM.Show();
        }
    }
    function showLoadingPanelPopUPT(s, e) {
        var isValid = ASPxClientEdit.ValidateGroup("vgTra");
        if (isValid == true) {
            lp_popupM.Show();
        }
    }
    function showCurrentDayCT(s, e) {
        s.SetText(new Date());
        s.SetMinDate = new Date();
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div>
<div class="row">
    
        <div class="col-md-12">
            <h1 class="page-header">
                Mượn Sách
            </h1>
        </div>
</div>
<div class="row" >
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-body">
                <div class="row" id="containerM" >
                    <div class="col-lg-6">
                        <div class="form-group">
                            <label> Tài Khoản </label>
        
                            <dx:ASPxComboBox ID="cb_taikhoan" runat="server" ValueType="System.String" IncrementalFilteringMode="Contains"  TextField="taikhoan" ValueField="id" CssClass="form-control" NullText="Chọn Tài Khoản...">
                            <ValidationSettings SetFocusOnError="true" ErrorTextPosition="Bottom" ValidationGroup="vgMuon"  >
                                <RequiredField ErrorText="Chưa Chọn Tài Khoản" IsRequired="true" />  
                            </ValidationSettings>
                            </dx:ASPxComboBox>
                        </div>
                        <div class="form-group">
                            <label> Mã Sách </label>
                            <dx:ASPxToKenBox ID="tkb_idsach" runat="server"   ItemValueType="System.String" 
                            CssClass="tokenbox" NullText="Nhập Mã Sách..."  
                                ClientInstanceName="tkb_idsach"  Width="100%" TextField="id_sach" 
                                ValueField="id_sach" AllowCustomTokens="False"  >
                            <ValidationSettings SetFocusOnError="true" ErrorTextPosition="Bottom" ValidationGroup="vgMuon" >
                                <RequiredField ErrorText="Chưa Nhập Mã Sách" IsRequired="true" />  
                            </ValidationSettings> 
                            </dx:ASPxToKenBox>                             
                            
                        </div>
                        
                        <div class="form-group">
                        <div style="float: left" >
                            <label> Kiểu Mượn </label>
                            <dx:ASPxComboBox ID="cbb_kieumuon" runat="server" CssClass="form-control"  NullText="Chọn Kiểu Mượn..." Width="100%" >
                            <Items>
                            <dx:ListEditItem Text="Mượn Về Nhà"  Value="1"/>
                            <dx:ListEditItem Text="Mượn Tại Chỗ" Value="0"/> 
                            </Items>
                            <ValidationSettings ValidationGroup="vgMuon" ErrorTextPosition="Bottom" SetFocusOnError="true" >
                                <RequiredField IsRequired="true" ErrorText="Chưa Chọn Kiểu Mượn"  />
                            </ValidationSettings> 
                            <ClientSideEvents SelectedIndexChanged="showCurrentDayT" /> 
                            </dx:ASPxComboBox>
                            </div>
                            
                        </div>
                    </div>
                    
                    <div class="col-lg-6">
                        <div class="form-group">
                            <label> Ngày Mượn </label>
                            <dx:ASPxDateEdit ID="de_ngaymuon" runat="server" CssClass="form-control" NullText="Chọn Ngày Mượn..." Width="100%" DisplayFormatString="dd/MM/yyyy" EditFormatString="dd/MM/yyyy">
                            <ClientSideEvents Init="showCurrentDayM" />
                            <ValidationSettings ValidationGroup="vgMuon" ErrorTextPosition="Bottom" SetFocusOnError="true" >
                                <RequiredField IsRequired="true" ErrorText="Chưa Chọn Ngày Mượn"  />
                            </ValidationSettings> 
                            </dx:ASPxDateEdit>
                        </div>
                        <div class="form-group">
                            <label> Ngày Hẹn Trả </label>
                            <dx:ASPxDateEdit ID="de_ngaytra" runat="server" CssClass="form-control" NullText="Chọn Ngày Hẹn Trả..." Width="100%" DisplayFormatString="dd/MM/yyyy" EditFormatString="dd/MM/yyyy" ClientInstanceName="de_ngaytra">
                            <ValidationSettings ValidationGroup="vgMuon" ErrorTextPosition="Bottom" SetFocusOnError="true" >
                                <RequiredField IsRequired="true" ErrorText="Chưa Chọn Ngày Hẹn Trả"  />
                            </ValidationSettings>
                               
                            </dx:ASPxDateEdit>
                        </div>
                        <div class="form-group">
                            <dx:ASPxButton ID="btn_xacnhanmuon" runat="server" CssClass="btn btn-primary" Text="Xác nhận" ValidationGroup="vgMuon">
                            <ClientSideEvents Click="showLoadingPanelPopUPM" /> 
                            </dx:ASPxButton>
                            <dx:ASPxButton ID="btn_hoantacmuon" runat="server" Text="Hoàn Tác" CssClass="btn btn-danger" CausesValidation="false" >
                            <ClientSideEvents Click="clearAllTextM"/>
                            </dx:ASPxButton>
                        </div>
                        <dx:ASPxLoadingPanel ID="lp_popupM" runat="server" ContainerElementID="popup_muonsach" ClientInstanceName="lp_popupM" Modal="true">
                        </dx:ASPxLoadingPanel>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="row">
        <div class="col-md-12">
            <h1 class="page-header">
                Trả Sách
            </h1>
        </div>
</div>
<div class="row" >
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-body">
                <div class="row" id="containerT">
                    <div class="col-lg-6">
                        <div class="form-group">
                            <label> Tài Khoản </label>
                            <dx:ASPxComboBox ID="cb_taikhoantra" runat="server" ValueType="System.String" CssClass="form-control" NullText="Chọn Tài Khoản..." Width="100%" AutoPostBack="true" ClientInstanceName="cb_taikhoantra" TextField="taikhoan" ValueField="taikhoan" IncrementalFilteringMode="Contains">
                             <ValidationSettings ValidationGroup="vgTra" ErrorTextPosition="Bottom" SetFocusOnError="true" >
                                <RequiredField IsRequired="true" ErrorText="Chưa Chọn Tài Khoản" />
                                  
                            </ValidationSettings>
                            <ClientSideEvents SelectedIndexChanged="loadingPanelMaSach" />
                            </dx:ASPxComboBox>
                        </div>
                        <div class="form-group">
                            <label> Ngày Trả </label>
                            <dx:ASPxDateEdit ID="de_chonngaytra" runat="server" CssClass="form-control" NullText="Chọn Ngày Trả..." Width="100%" DisplayFormatString="dd/MM/yyyy" EditFormatString="dd/MM/yyyy" >
                            
                            <ValidationSettings ValidationGroup="vgTra" ErrorTextPosition="Bottom" SetFocusOnError="true" >
                                <RequiredField IsRequired="true" ErrorText="Chưa Chọn Ngày Trả"  />
                            </ValidationSettings> 
                            </dx:ASPxDateEdit>
                        </div>                                             
                    </div>                   
                    <div class="col-lg-6">
                        <div class="form-group">
                            <label> Mã Sách </label>
                            <dx:ASPxToKenBox ID="tkb_masachtra" runat="server"   ItemValueType="System.String" 
                            CssClass="tokenbox" NullText="Nhập Mã Sách..."  
                                ClientInstanceName="tkb_idsach"  Width="100%" TextField="id_sach" 
                                ValueField="id_sach" AllowCustomTokens="False">
                            <ValidationSettings ValidationGroup="vgTra" ErrorTextPosition="Bottom" SetFocusOnError="true"  >
                                <RequiredField ErrorText="Chưa Nhập Mã Sách" IsRequired="true" />  
                            </ValidationSettings>
                            </dx:ASPxToKenBox>                                                                               
                        </div>   
                        <div class="form-group">                   
                            <dx:ASPxButton ID="btn_xacnhantra" runat="server" CssClass="btn btn-primary" Text="Xác nhận" ValidationGroup="vgTra">
                            <ClientSideEvents Click="showLoadingPanelPopUPT" /> 
                            </dx:ASPxButton>
                             <dx:ASPxButton ID="btn_hoantactra" runat="server" Text="Hoàn Tác" CssClass="btn btn-danger" CausesValidation="false"   >
                            <ClientSideEvents Click="clearAllTextT"/>
                            </dx:ASPxButton>
                        </div>
                    </div>
                     <dx:ASPxLoadingPanel ID="lp_popupT" runat="server" ContainerElementID="popup_trasach" ClientInstanceName="lp_popupM" Modal="true" >
                        </dx:ASPxLoadingPanel>
                    <dx:ASPxLoadingPanel ID="lp_masach" runat="server" Modal="true" ContainerElementID="containerT" ClientInstanceName="lp_masach" ValidateRequestMode="Enabled">
                    </dx:ASPxLoadingPanel>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="row" id="containerP">
<div class="col-lg-12">
    <dx:ASPxPopupControl ID="popup_muonsach" runat="server" ClientInstanceName="popup_muonsach"
     PopupAnimationType="Fade" AllowResize="TRUE" AllowDragging="TRUE"
      HeaderText="Thông Tin Sách Mượn" HeaderStyle-BackColor="GhostWhite" HeaderStyle-Font-Bold="true" 
       Width="900px" Height="400px" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" EnableTheming="True" EnableViewState="false" Modal="true" CloseOnEscape="True">
       <ClientSideEvents CloseUp="clearContentUrl"/> 
    </dx:ASPxPopupControl>
    <dx:ASPxPopupControl ID="popup_xacnhanmuon" runat="server"   ClientInstanceName="popup_xacnhanmuon"
     PopupAnimationType="Fade" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" Modal="true" CloseOnEscape="True" Width="900px" Height="400px" HeaderText="Xác Nhận Mượn" AllowResize="TRUE" AllowDragging="TRUE" HeaderStyle-Font-Bold="true"
     PopupHorizontalOffset="40" PopupVerticalOffset="20" >
        <ClientSideEvents CloseUp="clearContentUrl"/>
    </dx:ASPxPopupControl>
    <dx:ASPxPopupControl ID="popup_trasach" runat="server" ClientInstanceName="popup_trasach"
     PopupAnimationType="Fade" AllowResize="true" AllowDragging="TRUE" 
      HeaderText="Xác Nhận Trả" HeaderStyle-BackColor="GhostWhite" HeaderStyle-Font-Bold="true" 
       Width="950px" Height="400px" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" EnableTheming="True" EnableViewState="false" Modal="true" CloseOnEscape="True">
        <ClientSideEvents CloseUp="clearContentUrl"/>
    </dx:ASPxPopupControl>
    </div>
</div>
</div>
</ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

